package com.open.free.generator.base;

import com.open.free.generator.result.ResultData;
import com.open.free.generator.result.ResultEnum;

/**
 * @author Faye.Wang
 * @version 1.0
 * @date 2020/12/19 10:27
 * @Description
 */
public class BaseController<T> {
    /**
     * 操作成功返回
     * @return
     */
    public ResultData resultSuccess(){
        return  new ResultData<>(ResultEnum.HTTP_SUCCESS.getCode(),ResultEnum.HTTP_SUCCESS.getMessage());
    }

    public ResultData resultSuccess(T data){
        return  new ResultData<>(ResultEnum.HTTP_SUCCESS.getCode(),ResultEnum.HTTP_SUCCESS.getMessage(),data);
    }
    public ResultData resultFail(){
        return  new ResultData<>(ResultEnum.HTTP_ERROR_500.getCode(),ResultEnum.HTTP_ERROR_500.getMessage());
    }

    public ResultData resultFail(T data){
        return  new ResultData<>(ResultEnum.HTTP_ERROR_500.getCode(),data.toString(),data);
    }

}
